#ifndef SHADER_H
#define SHADER_H

#include "Export.h"
#include "ShaderBase.h"
#include "Vector2.h"
#include "Vector3.h"
#include "Color4.h"
#include "GL/glew.h"

namespace glow {

class SHARED Shader
{
    public:
		
		/**
		 *	Constructor of the Shader
		 *\param vtshader pointer to the ShaderBase VertexShader
		 *\param pcshader pointer to the ShaderBase FragmentShader
		 **/
        Shader(ShaderBase *vtshader = NULL, ShaderBase *pcshader = NULL);
		
		/**
		 *	Constructor of the Shader
		 *\param vtname the filename of the VertexShader
		 *\param pcname the filename of the FragmentShader
		 **/
        Shader(const char *vtname, const char *pcname);
		
		/**
		 *	Destructor of the Shader
		 **/
        ~Shader();

		/**
		 *	Load the Shader
		 *\param vtname filename of the VertexShader
		 *\param pcname filename of the FragmentShader
		 **/
        void load(const char *vtname, const char *pcname);

		/**
		 *	Set the Shader activity
		 *\param set true if the Shader must be active, else false
		 **/
        void setShader(bool set);

		/**
		 *	Get if the Shader is activate
		 *\return true if the Shader is activate, else false
		 **/
        bool isShader();
		
		/**
		 *	Get the ident of the Shader
		 *\return the ident of the Shader
		 **/
        GLuint getProgram() const;

		/**
		 * 	Get the VertexShader of the Shader
		 *\return the VertexShader of the Shader
		 **/
        ShaderBase *getVertexShader() const;
		
		/**
		 * 	Get the FragmentShader of the Shader
		 *\return the FragmentShader of the Shader
		 **/
        ShaderBase *getPixelShader() const;

		/**
		 *	Set the value in the GLValue with the Shader
		 *\param name the name of the GL value
		 *\param value the value set in the GL value
		 **/
        void setParameter(const char *name, int value);
		
		/**
		 *	Set the value in the GLValue with the Shader
		 *\param name the name of the GL value
		 *\param value the value set in the GL value
		 **/
        void setParameter(const char *name, float value);
		
		/**
		 *	Set the value in the GLValue with the Shader
		 *\param name the name of the GL value
		 *\param value the value set in the GL value
		 **/
        void setParameter(const char *name, const Vector2f& value);
		
        /**
		 *	Set the value in the GLValue with the Shader
		 *\param name the name of the GL value
		 *\param value the value set in the GL value
		 **/
        void setParameter(const char *name, const Vector3f& value);
        
		/**
		 *	Set the value in the GLValue with the Shader
		 *\param name the name of the GL value
		 *\param value the value set in the GL value
		 **/
        void setParameter(const char *name, const Color4f& value);
        
		/**
		 *	Release the Shader
		 **/
        void clear();

    private:

        void create();

        GLuint _program;
        ShaderBase *_vtshader, *_pcshader;
        bool _created;

};

}

#endif
